using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ModButton : MonoBehaviour
{
    public Button Button;
    public Text ButtonText;
    public object ModTag;
    public List<object> ModTags = new List<object>();

    private Action<ModButton> ActionOnClick = null;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    public string Text
    {
        get { return ButtonText.text; }
        set { ButtonText.text = value; }
    }
    public int FontSize
    {
        get { return ButtonText.fontSize; }
        set { ButtonText.fontSize = value; }
    }
    public void SetButtonColor(Color color)
    {
        ColorBlock cb = Button.colors;
        cb.normalColor = color;
        Button.colors = cb;
    }
    public void SetTextColor(Color color)
    {
        ButtonText.color = color;
    }
    public void SetTags(params object[] args)
    {
        ModTags.Clear();
        ModTags.AddRange(args);
    }
    public void AddTags(params object[] args)
    {
        ModTags.AddRange(args);
    }
    public void SetOnClick(Action<ModButton> call)
    {
        ActionOnClick = call;
        Button.onClick.AddListener(() => ActionOnClick?.Invoke(this));
    }
}
